/* eslint-disable no-console */
import { Upload, Button, message } from "antd";
import { UploadOutlined } from "@ant-design/icons";
import axios from "axios";
import React from "react";

export default function App() {
  const uploader = "hkw";
  const manager = "hkw";

  const props = {
    name: "file",
    action: `http://47.106.171.221:8810/oss/upload/${uploader}/${manager}`,
    headers: {
      authorization: "authorization-text",
      contentType: "multipart/form-data",
    },
    onChange(info: any) {
      // if (info.file.status !== "uploading") {
      // console.log(info.file, info.fileList);
      console.log(info);
      if (info.file.response && info.file.response.code === 0) {
        message.success("上传成功");
      }
    },
  };
  return (
    <Upload {...props}>
      <Button icon={<UploadOutlined />}>点击上传文件</Button>
    </Upload>
  );
}
